package com.fary;

import com.fary.runlistener.MyApplicationRunListener;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.SpringBootVersion;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;

import javax.annotation.PostConstruct;
import java.security.CodeSource;

/**
 * @author Fary
 * @version 1.0
 * @description: TODO
 * @date 2022/2/7 15:51
 */
@Slf4j
@SpringBootApplication
public class AppStarter {
    public static void main(String[] args) {
//        System.setProperty("org.springframework.boot.logging.LoggingSystem", "none");
        SpringApplication springApplication = new SpringApplication(AppStarter.class);
        springApplication.setAdditionalProfiles("dev");
        ConfigurableApplicationContext applicationContext = springApplication.run(args);
        for (String beanDefinitionName : applicationContext.getBeanDefinitionNames()) {
            System.out.println(beanDefinitionName);
        }
        System.out.println();
    }

    @Value("${binder.test.user}")
    String userName;

    @PostConstruct
    public void post() {
        log.info("--------------------------------");
        log.info(userName);
    }
}
